

package com.viweb.storemanager.core;

import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.text.JTextComponent;

// @author Santhosh Kumar T - santhosh@in.fiorano.com
class CutAction extends AbstractAction{
    JTextComponent comp;
    
    public CutAction(JTextComponent comp){
        super("Cut");
        this.comp = comp;
    }
    
    public void actionPerformed(ActionEvent e){
        comp.cut();
    }
    
    public boolean isEnabled(){
        return comp.isEditable()
        && comp.isEnabled()
        && comp.getSelectedText()!=null;
    }
}